<!DOCTYPE html>
<html lang="en">

<head>
    <title></title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
    <link rel="stylesheet" href="../res/css/weui.css" />
    <link rel="stylesheet" href="../res/css/weuix.css" />
    <link rel="stylesheet" href="../res/css/common.css" />
    <script src="../res/js/zepto.min.js"></script>
    <script src="../res/js/zepto.weui.js"></script>
    <script src="../res/js/picker.js"></script>
    <script src="../res/js/common.js?v=5"></script>
    <script src="../res/js/template-web.js"></script>
    <script src="../res/js/picker.city.js"></script>
</head>
<style>
    .weui-header {
        position: fixed;
        top: 0;
        width: 100%;
        z-index: 1000;
    }

    .top {
        margin-top: 50px;
        width: 100%;
        height: 40px;
        line-height: 40px;
        color: #2E4A70;
        font-size: 13px;
        font-family: PingFang-SC-Medium;
        text-align: center;
    }

    .top img {
        width: 11px;
        height: 13px;
    }

    input {
        text-align: right;
    }

    .weui-cell {
        margin: 0;
        padding: 15px 15px;
        border-bottom: 1px solid #E6E6E6;
        display: flex;
        flex-wrap: wrap;
    }

    .weui-cell .chooseLabel {
        width: 40%;
        display: flex;
    }

    .weui-cell .chooseLabel div {
        width: 50%;
        display: flex;
    }

    .weui-cell .chooseLabel img {
        width: 20px;
        height: 20px;
        margin-top: 2.5px;
        margin-right: 5px;
    }

    .weui-cell .chooseLabel img .hide {
        display: none;
    }

    .weui-textarea {
        width: 90%;
        margin: 5px 5%;
        padding: 20rpx 40rpx !important;
        background-color: #FAFAFA;
        border-radius: 10rpx;
    }

    .bottomBtn {
        z-index: 100;
        display: flex;
        justify-content: center;
        align-items: center;
        position: fixed;
        width: 100%;
        bottom: 0;
        height: 70px;
        background: #fff;
    }

    .bottomBtn div {
        flex: 1;
        font-size: 32rpx;
        background: #03A6FF;
        color: #fff;
        border-radius: 10px;
        height: 50px;
        line-height: 50px;
        text-align: center;
        margin: 10px;
    }

    .chooseBtn {
        padding: 10px 0;
        width: 61px;
        text-align: center;
        background: #F5F5F6;
        border-radius: 5px;
        margin: 0 0 15px 9px;
        border: 1px solid #fff;
    }

    .active {
        background-color: #F5FBFF;
        color: #03A6FF;
        border: 1px solid #03A6FF;
    }

    .pay-model {
        /* text-align: center; */
        display: flex;
        justify-content: space-around;
    }

    /* .pay-model p input[type="radio"]{} */

    #radiosWrappar {
        margin-top: 10px;
    }

    .weui-cell__hd {
        position: relative;
    }

    .pay-model-cell>div {
        flex-basis: 100%;
    }

    .cell_wrap {
        display: flex;
        flex: 1;
    }

    .weui-cell__hd span {
        position: absolute;
        top: 0;
        right: 0;
    }

    #radio1 .weui-cell__hd span {
        position: unset;
    }

    .be_careful {
        text-align: right;
        width: 100%;
        color: red;
        font-size: 14px;
    }

    /* .hisTip {
        text-align: right;
        width: 100%;
        margin: 10px 0;
        font-size: 14px;
    } */

    /* 单选按钮选中效果 */
    .pay-model label {
        position: relative;
    }

    .pay-model input[type="radio"]+label::before {
        content: " ";
        display: inline-block;
        vertical-align: middle;
        width: 20px;
        height: 20px;
        border-radius: 50%;
        border: .064rem solid #dddddd;
        margin-right: .213333rem;
        box-sizing: border-box;
        position: relative;
        top: -2px;
    }

    .pay-model input[type="radio"]:checked+label::before {
        border-color: #03a6ff;
        background-color: #03a6ff;
        background-clip: content-box;
        box-sizing: border-box;
    }

    .pay-model input[type="radio"] {
        position: absolute;
        clip: rect(0, 0, 0, 0);
    }

    .pay-model input[type="radio"]:checked+label::after {
        content: ' ';
        display: block;
        position: absolute;
        top: 7px;
        left: 5px;
        width: 7px;
        height: 3px;
        z-index: 10;
        transform: rotateZ(-45deg);
        border: 3px solid #fff;
        border-right: none;
        border-top: none;
    }

    /* 初始隐藏监护人输入框 */
    .ifNeedGuardian{
        display: none;
    }
    
    #accompanyDoctor{
        margin-top: 10px;
        display: none;
    }
</style>

<script>
    //就诊人信息
    var patientInfoData = {
        id: '',
        patientAge: '', // 年龄
        province: '', //省
        city: '', // 市
        district: "", // 区
        patientHeight: "", // 身高
        isMarried: "0", // 是否婚配
        patientAddress: "", // 住址
        patientBirthday: "", // 出生日期 
        patientIdcard: "", // 身份证号
        patientMaritalStatus: "", // 籍贯
        patientName: "", // 姓名
        patientPhone: "", // 手机号码
        patientProfession: "", // 职业名称
        patientProfessionCode: "", // 职业Id
        patientSex: "1", // 性别
        patientSymptom: "", // 症状
        patientWeight: "", // 体重
        paymentMethod: "1", // 付费方式
        relationType: "", // 与您的关系
        isDrugAllergy: "0", // 是否药物过敏
        patientAllergyDetails: "", // 药物过敏史
        isMedicalHistory: 0, // 是否有既往病史
        medicalHistory: "", // 既往史
        isChildOption: '', // 孕期
        isPregnancy: 0, // 是否怀孕
        kidney: 0, // 肝功能
        liver: 0, // 肾功能
    }

    //1.9.7
    //模拟数据:就诊卡号
    // var cardNum = 12231133113213312

    //单选框信息
    var chooseRadioList = {
        list: [{
            text: '疾病史/妊娠哺乳',
            choose: 0,
            id: 'radio1',
            num: 0 //0为有 1为异常
        }, {
            text: '肝功能',
            choose: 0,
            id: 'radio2',
            num: 1
        }, {
            text: '肾功能',
            choose: 0,
            id: 'radio3',
            num: 1
        }, {
            text: '备孕/怀孕/哺乳期',
            choose: 0,
            id: 'radio4',
            num: 0
        }, {
            text: '药物过敏史',
            choose: 0,
            id: 'radio5',
            num: 0
        }, {
            text: '既往病史',
            choose: 0,
            id: 'radio6',
            num: 0
        }]
    }

    //婚姻状态变量
    var marryState = {
        list: [{
            choose: 1,
            text: '未婚',
        }, {
            choose: 0,
            text: '已婚'
        }, {
            choose: 0,
            text: '离婚'
        }, {
            choose: 0,
            text: '丧偶'
        }]
    };

    //显示变量
    var moreInfo = false,
        isChooseSex = false
    var workData = [],
        workList = [];

    const maxAgeOfGuardian = isChengDu ? 18 : 6  //需要填写监护人的年龄线

    //就诊人信息id(当id存在时,患者是过来修改删除信息的)
    var id = getQst("id");

    function rendering() {
        let params = {
            id
        }
        newAjaxPost("/h5/patientInfo/getInquiryPatientInfoById", params, (json) => {
            patientInfoData = json.data
            // console.log(patientInfoData);
            //根据拿到的数据修改页面信息
            //修改单选框信息
            chooseRadioList.list.forEach((ele, index) => {
                switch (index) {
                    case 1:
                        patientInfoData.kidney == 1 ? ele.choose = 1 : ele.choose = 0;
                        break;
                    case 2:
                        patientInfoData.liver == 1 ? ele.choose = 1 : ele.choose = 0;
                        break;
                    case 3:
                        patientInfoData.isChildOption ? ele.choose = 1 : ele.choose = 0;
                        break;
                    case 4:
                        patientInfoData.isDrugAllergy == 1 ? ele.choose = 1 : ele.choose = 0;
                        break;
                    case 5:
                        patientInfoData.medicalHistory ? ele.choose = 1 : ele.choose = 0;
                        break;
                }
            });
            //婚姻状态修改
            if (patientInfoData.isMarried) {
                marryState.list.forEach((item, index) => {
                    if (patientInfoData.isMarried == index) {
                        item.choose = 1;
                    } else {
                        item.choose = 0;
                    }
                })
            };
            // console.log(marryState);

            // 付费类型
            if (patientInfoData.paymentMethod === 2) {
                $('#health-insurance').attr('checked', true)
            } else {
                $('#self').attr('checked', true)
            }

            // 根据就诊人的年龄判定是否需要监护人和陪伴医师
            checkAge(patientInfoData.patientIdcard)

            $("#height").val(patientInfoData.patientHeight);
            $("#weight").val(patientInfoData.patientWeight);
            $("#addressInfo").val(patientInfoData.patientAddress);
            $("#patientIdcard").val(patientInfoData.patientIdcard);
            $("#patientPhone").val(patientInfoData.patientPhone);
            $("#patientName").val(patientInfoData.patientName);

            // 如果就诊人需要监护人等
            if($(".ifNeedGuardian").css('display') != 'none'){
                // 监护人
                $("#guardianName").val(patientInfoData.guardian);
                $("#guardianIdcard").val(patientInfoData.guardianIdcard);
                // 陪伴医师
                $("#accompanyDoctorName").val(patientInfoData.accompanyDoctorName)
            }
            switch (Number(patientInfoData.relationType)) {
                case 0:
                    $("#relation").val("本人");
                    break;
                case 1:
                    $("#relation").val("其他");
                    break;
                case 2:
                    $("#relation").val("父母");
                    break;
                case 3:
                    $("#relation").val("配偶");
                    break;
                case 4:
                    $("#relation").val("子女");
                    break;
                case 5:
                    $("#relation").val("朋友");
                    break;
            }
            $("#work").val(patientInfoData.patientProfession)
            $("#start").val(`${patientInfoData.province} ${patientInfoData.city} ${patientInfoData.district}`)
            //判断隐藏部分是否展开
            if (patientInfoData.liver == 1 || patientInfoData.kidney == 1 || patientInfoData.isDrugAllergy ==
                1 || patientInfoData.isMedicalHistory == 1 || patientInfoData.isPregnancy == 1) {
                chooseRadioList.list[0].choose = 1;
                isChooseSex = true;
                createRadio()
            }
            if (patientInfoData.patientHeight || patientInfoData.patientWeight || patientInfoData
                .patientAddress || patientInfoData.province || patientInfoData.patientProfessionCode) {
                showAdd();
            }
        })
    }

    //单选页面渲染
    function createRadio() {
        let html = template("recipeList", chooseRadioList);
        var container = document.getElementById("radiosWrappar");
        container.innerHTML = html;
        if (id) {
            //书写框内容写入
            $("#DrugAllergy").val(patientInfoData.patientAllergyDetails)
            $("#MedicalHistory").val(patientInfoData.medicalHistory)
            //备孕按钮渲染
            switch (patientInfoData.isChildOption) {
                case "备孕":
                    $(".chooseBtn").eq(0).addClass('active')
                    $(".chooseBtn").eq(0).siblings().removeClass('active')
                    break;
                case "怀孕":
                    $(".chooseBtn").eq(1).addClass('active')
                    $(".chooseBtn").eq(1).siblings().removeClass('active')
                    break;
                case "哺乳期":
                    $(".chooseBtn").eq(2).addClass('active')
                    $(".chooseBtn").eq(2).siblings().removeClass('active')
                    break;
            }

        } else {}
        if (!isChooseSex || patientInfoData.patientSex == 1) {
            $("#radio4").hide()
        }
    }
    //改变单选框状态
    function changeRadio(i) {
        if (chooseRadioList.list[i].choose == 1) {
            chooseRadioList.list[i].choose = 0;
        } else {
            chooseRadioList.list[i].choose = 1;
        }

        //判断赋值
        switch (i) { //0.疾病史 1.肝功能2.肾功能 3.是否怀孕 4.过敏史5.既往病史
            case 0:
                if (patientInfoData.patientSex == 0 && chooseRadioList.list[0].choose == 1) {
                    $("#radio4").show()
                    isChooseSex = true;
                }
                break;
            case 1:
                patientInfoData.kidney = chooseRadioList.list[i].choose;
                break;
            case 2:
                patientInfoData.liver = chooseRadioList.list[i].choose;
                break;
            case 3:
                patientInfoData.isPregnancy = chooseRadioList.list[i].choose;
                break;
            case 4:
                patientInfoData.isDrugAllergy = chooseRadioList.list[i].choose;
                break;
            case 5:
                patientInfoData.isMedicalHistory = chooseRadioList.list[i].choose;
                break;
        }
        createRadio()
    }
    //获取职业字典
    function getOccupationList() {
        newAjaxPost("/h5/inquiryLog/getOccupationList", {}, (json) => {
            workData = json.data.list;
            workData.forEach(element => {
                workList.push(element.occupationName)
            });
        });
    }

    //婚姻状态渲染
    function chooseMarry() {
        let marryHtml = template("marryChooseList", marryState);
        var marryChoose = document.getElementById("marryChoose");
        marryChoose.innerHTML = marryHtml;
    }
    //婚姻状态改变
    function changeMarryState(i) {
        patientInfoData.isMarried = String(i)
        if (marryState.list[i].choose == 1) {} else {
            marryState.list.forEach((item, index) => {
                item.choose = 0;
                marryState.list[i].choose = 1
            })
        }
        chooseMarry()
    }
    //获取出生日期，性别其他
    function getOtherInfo() {
        if (isEmpty($("#patientName").val())) {
            msgInfo('请输入姓名');
            return false;
        } else {
            patientInfoData.patientName = $("#patientName").val();
        }
        if (isEmpty($("#patientIdcard").val())) {
            msgInfo('请输入身份证');
            return false;
        }
        if (isEmpty($("#patientPhone").val())) {
            msgInfo('请输入手机号');
            return false;
        } else if (!IsPhone($("#patientPhone").val())) {
            msgInfo('请输入正确的手机号');
            return false;
        }
        if ($("#relation").val() == "") {
            msgInfo('请选择患者与您的关系');
            return false;
        }
        if($(".ifNeedGuardian").css('display') != 'none'){
            if(isEmpty($("#guardianName").val())){
                msgInfo('请输入监护人姓名');
                return false;
            }
            if(isEmpty($("#guardianIdcard").val())){
                msgInfo('请输入监护人身份证');
                return false;
            }

            if(isEmpty($("#accompanyDoctorName").val())){
                msgInfo('请输入陪伴医师')
                return false
            }
        }

        //身高，体重，详细地址，名字，电话号码...，
        patientInfoData.patientHeight = $("#height").val();
        patientInfoData.patientWeight = $("#weight").val();
        patientInfoData.patientAddress = $("#addressInfo").val();
        patientInfoData.patientIdcard = $("#patientIdcard").val();
        patientInfoData.patientPhone = $("#patientPhone").val();
        
        // 付费方式
        patientInfoData.paymentMethod = $('input[name="paymentMethod"]:checked').val()
        
        // 监护人
        patientInfoData.guardian = $("#guardianName").val();
        patientInfoData.guardianIdcard = $("#guardianIdcard").val();
        
        // 陪伴医师
        patientInfoData.accompanyDoctorName = $("#accompanyDoctorName").val()


        if (IsIdCard(patientInfoData.patientIdcard)) {
            let idNo = patientInfoData.patientIdcard
            let tmpStr = "";
            let age = ''
            let sex = ""
            if (idNo.length == 15) {
                tmpStr = idNo.substring(6, 12);
                tmpStr = "19" + tmpStr;
                age = new Date().getFullYear() - tmpStr.substring(0, 4)
                tmpStr = tmpStr.substring(0, 4) + "-" + tmpStr.substring(4, 6) + "-" + tmpStr.substring(6)
                sex = idCard.substring(14, 15) % 2
            } else if (idNo.length == 18) {
                tmpStr = idNo.substring(6, 14);
                age = new Date().getFullYear() - tmpStr.substring(0, 4)
                tmpStr = tmpStr.substring(0, 4) + "-" + tmpStr.substring(4, 6) + "-" + tmpStr.substring(6)
                sex = idNo.substring(14, 17) % 2
            }
            patientInfoData.patientBirthday = tmpStr;
            patientInfoData.patientAge = age;
            patientInfoData.patientSex = sex;
            return true;
        } else {
            msgInfo('请输入正确的身份证号')
            return false;
        }
    }
    //点击显示更多页面
    function showAdd() {
        console.log(moreInfo);
        moreInfo = !moreInfo
        if (moreInfo) {
            $(".Pulldown").hide()
            $(".spread").show()
            $(".otherInfo").show()
        } else {
            $(".Pulldown").show()
            $(".spread").hide()
            $(".otherInfo").hide()
        }
    }
    //保存新增信息
    function saveInfo() {
        if (getOtherInfo()) {
            newAjaxPost("/h5/patientInfo/addPatientInfo", patientInfoData, (json) => {
                if (json.code == 1) {
                    msgInfo(json.msg)
                    setTimeout(() => {
                        goPageNo(-1)
                    }, 1000)
                } else {
                    msgInfo(json.msg)
                }
            })
        }
    }
    //修改就诊人信息
    function updateInfo() {
        if(getOtherInfo()) {
            newAjaxPost("/h5/patientInfo/updateInquiryPatientInfo", patientInfoData, (json) => {
                if (json.code == 1) {
                    msgInfo("修改成功")
                    setTimeout(() => {
                        goPageNo(-1)
                    }, 500)
                } else {
                    msgInfo(json.msg)
                }
            })
        }
    }
    //备孕按钮按钮选择
    function chooseBtn(e) {
        $(e).addClass('active')
        $(e).siblings().removeClass('active')
        patientInfoData.isChildOption = $(e).text()
    }
    //身份证判断
    function checkId(e) {
        var idCode = $("#patientIdcard").val()
        if (isEmpty(idCode)) {
            msgInfo('请输入身份证', 800);
            return;
        }
        if (IsIdCard(idCode)) {
            let idNo = idCode
            let sex = ""
            if (idNo.length == 15) {
                sex = idCard.substring(14, 15) % 2
            } else if (idNo.length == 18) {
                sex = idNo.substring(14, 17) % 2
            }
            patientInfoData.patientSex = sex;
            if (sex == 0) {
                chooseMarry()
            }
            checkAge(idCode)
        } else {
            msgInfo('请输入正确的身份证号')
        }
    }
    //监护人身份证判断
    function checkGuardianId(e) {
        var idCode = $("#guardianIdcard").val()
        if (isEmpty(idCode)) {
            msgInfo('请输入监护人身份证');
            return;
        }
        if (!IsIdCard(idCode)) {
            msgInfo('请输入正确的身份证号')
        }
    }
    //输入框
    function textareaChange(e) {
        let id = $(e).attr("id");
        if (id == "DrugAllergy") {
            patientInfoData.patientAllergyDetails = $(e).val();
        } else {
            patientInfoData.medicalHistory = $(e).val();
        }
    }
    //删除就诊人信息
    function deleteInfo() {
        let params = {
            id
        }
        newAjaxPost("/h5/patientInfo/deleteInterrogationHistoryInfo", params, (json) => {
            msgInfo(json.msg)
            setTimeout(() => {
                goPageNo(-1);
            }, 500)
        })
    }

    //1.9.7
    //渲染就诊人卡号
    function wCardNum() {
        newAjaxPost("/h5/inquiryPatientInfo/queryMedicalCardByinquiryPatientId", { id }, (res) => {
            if (res.data.isHealthCardNo == 1){
                $("#healthCardRow").show()
                $(".cardNum").html(`<div style="text-align:right">${res.data.healthCardNo}</div>`)
            }
        })
        
    }

    function checkAge(idCard) {
        // 第一代身份证持有人应该都出生超过6年了 所以不做后续判断
        if(idCard.length == 15) { 
            $("#accompanyDoctor").hide()
            return 
        }

        let bornYear = Number(idCard.substring(6, 10)),
            bornMonth = Number(idCard.substring(10, 12)),
            bornDate = Number(idCard.substring(12, 14)),

            date = new Date(),
            nowYear = date.getFullYear(),
            nowMonth = date.getMonth() + 1,
            nowDate = date.getDate(),
            age = nowYear - bornYear;

        // 小于等于 maxAgeOfGuardian 岁 需填写 监护人 或 陪伴医师 成都大医睐18岁 其他医院6岁
        if (age > maxAgeOfGuardian || (age == maxAgeOfGuardian && nowMonth - bornMonth >= 1) || (age == maxAgeOfGuardian && nowMonth == bornMonth && nowDate > bornDate)) {
            $(".ifNeedGuardian").hide()
            $("#accompanyDoctor").hide()
        }else{
            $(".ifNeedGuardian").css('display', 'flex')
            $("#accompanyDoctor").css('display', 'flex')
        }
    }
    //点击显示提示
    function paymentChange(type) {
        // if (1) {
        //     type == 1 ? $(".hisTip").show() : $(".hisTip").hide()
        // }
    }

    // 隐藏付费类型选项
    function renderOfPayMeth() {
        if(!hasYiBao) {
            $(".pay-model-cell").hide()
        }
    }
    
    $(function () {
        $('#btnBack').on("click", function () {
            goPageNo(-1);
        });
        //判断就诊人是否来修改信息或删除信息
        if (id) {
            $("#writeSave").hide()
            $("#revise").show()
            rendering()
            checkId()
            
            $("#patientName").prop('disabled', true)
            $("#patientIdcard").prop('disabled', true)
        } else {
            $("#writeSave").show()
            $("#revise").hide()
        }
        //获取职业字典
        getOccupationList()
        $("#relation").picker({
            title: "",
            cols: [{
                textAlign: 'center',
                values: ['本人', '其他', '父母', '配偶', '子女']//, '朋友'
            }],
            onClose: function (p, v, d) {
                switch (p.cols[0].activeIndex) {
                    case 0:
                        patientInfoData.relationType = 0;
                        break;
                    case 1:
                        patientInfoData.relationType = 1;
                        break;
                    case 2:
                        patientInfoData.relationType = 2;
                        break;
                    case 3:
                        patientInfoData.relationType = 3;
                        break;
                    case 4:
                        patientInfoData.relationType = 4;
                        break;
                    case 5:
                        patientInfoData.relationType = 5;
                        break;
                }

            }
        });
        $("#work").picker({
            title: "",
            cols: [{
                textAlign: 'center',
                values: workList
            }],
            onClose: function (p, v, d) {
                patientInfoData.patientProfession = p.value[0];
                patientInfoData.patientProfessionCode = workData[p.cols[0].activeIndex].id
            },
        });

        // $("#address").picker({
        //     title: "",
        //     cols: [{
        //         textAlign: 'center',
        //         values: ['本人', '父母', '配偶', '子女', '其他']
        //     }],
        //     onChange: function (p, v, dv) {
        //         console.log(p, v, dv);
        //     },
        //     onClose: function (p, v, d) {
        //         console.log("close");
        //     }
        // });
        $("#start").cityPicker({
            title: "",
            onChange: function (picker, values, displayValues) {
                patientInfoData.province = displayValues[0];
                patientInfoData.city = displayValues[1];
                patientInfoData.district = displayValues[2];

            }
        });
        //生成html片段
        createRadio()
        //婚姻状态渲染
        chooseMarry()
        //就诊卡号渲染
        if(isHis){
            wCardNum()
        }

        // 判断有无医保付费
        renderOfPayMeth()
    })
</script>

<body>
    <div class="weui-header weui-btn_primary">
        <div class="weui-header-left"><a id="btnBack" class="icon icon-109"></a></div>
        <div class="weui-header-title">就诊人信息</div>
        <div class="weui-header-right"></div>
    </div>
    <div class="top"><img src="../res/images/safe.png" alt=""> 所有信息保密</div>
    <div class="weui-cell" id="healthCardRow" style="display: none;">
        <div class="weui-cell__hd"><label class="weui-label">就诊卡号</label></div>
        <div class="weui-cell__bd cardNum">

        </div>
    </div>
    <div class="weui-cell">
        <div class="weui-cell__hd"><label class="weui-label">姓名<span
                    style="color: red;margin-left: 10px;">*</span></label></div>
        <div class="weui-cell__bd">
            <input class="weui-input" placeholder="请输入姓名" id="patientName">
        </div>
    </div>
    <!-- 1.9.3 -->
    <div class="weui-cell pay-model-cell">
        <div class="cell_wrap">
            <div class="weui-cell__hd">
                <label class="weui-label"><span style="color: red;margin-left: 10px;">*</span>付费方式</label>
            </div>
            <div class="weui-cell__bd pay-model">
                <div>
                    <input type="radio" name="paymentMethod" id="self" value="1" checked onchange="paymentChange(0)">
                    <label for="self">自费</label>
                </div>
                <div>
                    <input type="radio" name="paymentMethod" id="health-insurance" value="2"
                        onchange="paymentChange(1)"> <label for="health-insurance">医保付费</label>
                </div>
            </div>
        </div>
        <!-- 1.9.7 -->
        <!-- <p class="hisTip" style="display: none;">门诊慢性病/门诊特定项目</p> -->
        <p class="be_careful">慎重填写, 若选错可以告知医生帮忙修改</p>
    </div>
    <div class="weui-cell">
        <div class="weui-cell__hd"><label class="weui-label">身份证号码<span
                    style="color: red;margin-left: 10px;">*</span></label></div>
        <div class="weui-cell__bd">
            <input class="weui-input" placeholder="请输入身份证号码" id="patientIdcard" onblur="checkId()" maxlength="18">
        </div>
    </div>
    <div class="weui-cell">
        <div class="weui-cell__hd"><label class="weui-label">手机号码<span
                    style="color: red;margin-left: 10px;">*</span></label></div>
        <div class="weui-cell__bd">
            <input class="weui-input" placeholder="请输入手机号码" id="patientPhone" maxlength="11">
        </div>
    </div>
    <div class="weui-cell">
        <div class="weui-cell__hd"><label class="weui-label">与您的关系<span
                    style="color: red;margin-left: 10px;">*</span></label></div>
        <div class="weui-cell__bd" style="display: flex;">
            <input class="weui-input" id="relation" type="text" value="" placeholder="请选择与您的关系">
            <img src="../res/images/arrow-Pulldown.png" alt="" style="width: 8px;margin-top: 5px;margin-left: 5px;">
        </div>
    </div>
    
    <div class="weui-cell ifNeedGuardian" style="margin-top: 10px;">
        <div class="weui-cell__hd"><label class="weui-label">监护人姓名<span
                    style="color: red;margin-left: 10px;">*</span></label></div>
        <div class="weui-cell__bd" style="display: flex;">
            <input class="weui-input" id="guardianName" type="text" value="" placeholder="监护人姓名">
        </div>
    </div>
    <div class="weui-cell ifNeedGuardian">
        <div class="weui-cell__hd"><label class="weui-label">监护人身份证<span
                    style="color: red;margin-left: 10px;">*</span></label></div>
        <div class="weui-cell__bd" style="display: flex;">
            <input class="weui-input" id="guardianIdcard" type="text" value="" placeholder="监护人身份证" onblur="checkGuardianId()">
        </div>
    </div>

    <div class="weui-cell" id="accompanyDoctor">
        <div class="weui-cell__hd" >
            <label class="weui-label" for="accompanyDoctorName">
                陪伴医师<span style="color: red;margin-left: 10px;">*</span>
            </label>
        </div>
        <div class="weui-cell__bd" >
            <input class="weui-input" type="text" id="accompanyDoctorName" maxlength="20">
        </div>
    </div>

    <div id="radiosWrappar">

    </div>
    <div class="weui-cell" style="margin-top: 10px;" id="addInfo" onclick="showAdd()">
        <div class="weui-cell__hd" style="margin-right: 20%;"><label class="weui-label">完善其他资料</label></div>
        <div class="weui-cell__bd" style="display: flex;">
            <div style="margin-right: 5%;">职业/体重/住址/婚姻状态</div>
            <img src="../res/images/arrow-Pulldown.png" alt="" style="width: 8px;margin-top: 6px;" class="Pulldown">
            <img src="../res/images/arrow-spread.png" alt="" style="width: 8px;margin-top: 6px;display: none;"
                class="spread">
        </div>
    </div>
    <div class="otherInfo" style="display: none;">
        <div class="weui-cell">
            <div class="weui-cell__hd"><label class="weui-label">职业</label></div>
            <div class="weui-cell__bd" style="display: flex;">
                <input class="weui-input" id="work" type="text" value="" placeholder="请选择">
                <img src="../res/images/arrow-Pulldown.png" alt="" style="width: 8px;margin-top: 5px;margin-left: 5px;">
            </div>
        </div>
        <div class="weui-cells weui-cells_form">
            <div class="weui-cell">
                <div class="weui-cell__hd"><label class="weui-label">所在地区</label></div>
                <div class="weui-cell__bd" style="display: flex;">
                    <input class="weui-input" id="start" type="text" value="" placeholder="请选择">
                    <img src="../res/images/arrow-Pulldown.png" alt=""
                        style="width: 8px;margin-top: 5px;margin-left: 5px;">
                </div>
            </div>
        </div>
        <div class="weui-cell">
            <div class="weui-cell__hd"><label class="weui-label">详细地址</label></div>
            <div class="weui-cell__bd">
                <input class="weui-input" placeholder="请填写" id="addressInfo">
            </div>
        </div>
        <div class="weui-cell">
            <div class="weui-cell__hd"><label class="weui-label">身高(cm)</label></div>
            <div class="weui-cell__bd">
                <input class="weui-input" placeholder="请填写" id="height">
            </div>
        </div>
        <div class="weui-cell">
            <div class="weui-cell__hd"><label class="weui-label">体重(kg)</label></div>
            <div class="weui-cell__bd">
                <input class="weui-input" placeholder="请填写" id="weight">
            </div>
        </div>
        <div class="weui-cell" id="married">
            <div class="weui-cell__hd" style="width:30%">
                <label class="weui-label" style="width: 100%;">
                    婚姻状态
                </label>
            </div>
            <div class="chooseLabel" style="width: 70%;" id="marryChoose">

            </div>
        </div>
    </div>
    <div style="margin-top: 50px;">&nbsp;</div>
    <div class="bottomBtn" id="writeSave">
        <div onclick="saveInfo()" id="writeSave">保存并实名认证</div>
    </div>
    <div class="bottomBtn" id="revise" style="display: none;">
        <div style="background: #F6F6F6 !important;color: #333333 !important;" onclick="deleteInfo()">删除</div>
        <div onclick="updateInfo()">保存</div>
    </div>
    <script id="recipeList" type="text/html">
        {{each list as value index}}
        {{if index==0}}
        <div class="weui-cell" id="{{value.id}}">
            {{else if index !=0 && list[0].choose == 0}}
            <div class="weui-cell" id="{{value.id}}" style="display: none;">
                {{else if index !=0 && list[0].choose == 1}}
                <div class="weui-cell" id="{{value.id}}">
                    {{/if}}
                    <div class="weui-cell__hd" style="width:60%">
                        <label class="weui-label" style="width: 100%;">{{value.text}}
                            {{if index == 0}}
                            <span style="color: red;margin-left: 10px;">*</span>
                            {{/if}}
                        </label>
                    </div>
                    <div class="chooseLabel" index="{{index}}">
                        <div onclick="changeRadio({{index}})">
                            <!-- 点击图片变化 -->
                            {{if value.choose == 1}}
                            <img src="../res/images/right.png" alt="" choose="1">
                            {{else if value.choose == 0}}
                            <img src="../res/images/wrong.png" alt="" choose="0">
                            {{/if}}
                            <!-- 判断选项文字显示 -->
                            {{if value.num == 0}}
                            <p>有</p>
                            {{else if value.num == 1}}
                            <p>异常</p>
                            {{/if}}
                        </div>
                        <div onclick="changeRadio({{index}})">
                            <!-- 点击图片变化 -->
                            {{if value.choose == 1}}
                            <img src="../res/images/wrong.png" alt="" choose="1">
                            {{else if value.choose == 0}}
                            <img src="../res/images/right.png" alt="" choose="0">
                            {{/if}}
                            <p>无</p>
                        </div>
                    </div>
                    <div style="width: 100%;">
                        <!-- 这三个选项判断选中才显示出来 -->
                        {{if index == 4 && value.choose==1}}
                        <textarea class="weui-textarea" placeholder="您对什么过敏" rows="3" id="DrugAllergy"
                            onchange="textareaChange(this)"></textarea>
                        {{else if index == 5 && value.choose==1}}
                        <textarea class="weui-textarea" placeholder="请输入既往病史" rows="3" id="MedicalHistory"
                            onchange="textareaChange(this)"></textarea>
                        {{else if index == 3 && value.choose==1}}
                        <div style="display: flex;margin-top: 10px;justify-content: right;">
                            <div class="chooseBtn" onclick="chooseBtn(this)">备孕</div>
                            <div class="chooseBtn" onclick="chooseBtn(this)">怀孕</div>
                            <div class="chooseBtn" onclick="chooseBtn(this)">哺乳期</div>
                        </div>
                        {{/if}}
                    </div>
                </div>
                {{/each}}
    </script>
    <!-- 婚姻状态渲染 -->
    <script id="marryChooseList" type="text/html">
        {{each list as value index}}
        <div onclick="changeMarryState({{index}})">
            {{if value.choose == 1}}
            <img src="../res/images/right.png" alt="">
            {{else if value.choose == 0}}
            <img src="../res/images/wrong.png" alt="">
            {{/if}}
            <p>{{value.text}}</p>
        </div>
        {{/each}}
    </script>
</body>

</html>